package com.starhub.engine.directory.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

@Data
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DirectoryTreeSelect implements Serializable {

    @Serial
    private static final long serialVersionUID = -1727664376976952427L;

    @ApiModelProperty(name = "title" , value = "")
    private String title;

    @ApiModelProperty(name = "value" , value = "")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long value;

    @ApiModelProperty(name = "parentId" , value = "")
    private Long parentId;

    private List<DirectoryTreeSelect> children;

    public void addChild(DirectoryTreeSelect child) {
        this.children.add(child);
    }

}
